package com.dmooo.yxmmerchant.fragment.model;

import android.content.Context;

import com.common.net.entity.SubjectPost;
import com.common.net.listener.HttpOnNextListener;
import com.common.net.subscribers.ProgressSubscriber;
import com.dmooo.yxmmerchant.fragment.contract.ServiceContract;
import com.dmooo.yxmmerchant.http.HttpManager;

import java.util.HashMap;
import java.util.Map;

public class ServiceModel implements ServiceContract.ServiceMdl {
    private Context context;
    public ServiceModel(Context context) {
        this.context=context;
    }

    @Override
    public void getBalanceRecord(String token, int page, HttpOnNextListener listener) {
        Map<String,Object> map=new HashMap<>();
        map.put("token",token);
        map.put("p",page);
        map.put("per",10);
        SubjectPost post=new SubjectPost(new ProgressSubscriber(listener,context,false,false,"删除中"),map);
        HttpManager.getInstance().getBalanceRecord(post);
    }

    @Override
    public void getDrawRecord(String token, int page, HttpOnNextListener listener) {
        Map<String,Object> map=new HashMap<>();
        map.put("token",token);
        map.put("p",page);
        map.put("per",10);
        SubjectPost post=new SubjectPost(new ProgressSubscriber(listener,context,false,false,"删除中"),map);
        HttpManager.getInstance().getDrawRecord(post);
    }

    @Override
    public void getGoodsMallStatistic(String token, HttpOnNextListener listener) {
        Map<String,Object> map=new HashMap<>();
        map.put("token",token);
        SubjectPost post=new SubjectPost(new ProgressSubscriber(listener,context,true,false,"删除中"),map);
        HttpManager.getInstance().statisticsByGoods(post);
    }

    @Override
    public void getServiceStatistic(String token, HttpOnNextListener listener) {
        Map<String,Object> map=new HashMap<>();
        map.put("token",token);
        SubjectPost post=new SubjectPost(new ProgressSubscriber(listener,context,true,false,"删除中"),map);
        HttpManager.getInstance().statisticsByService(post);
    }
}
